﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Contracts;
using Model;
using DAL_EF;

namespace Service
{
    public class ProjectBService:IProjectBService
    {
        public List<Model.Level> getLevelList()
        {
            Factory factory = new Factory();
            ILevelRepository levelResponsitory = factory.getLevelOperations();
            List<Model.Level> courseLevel = levelResponsitory.selectLevel();
            return courseLevel;
        }

        public List<Model.Course> obtainCourseName(int courseId)
        {
            Factory factory = new Factory();
            ISaveRepository saveRepository = factory.saveOperations();
            List<Model.Course> courseName = saveRepository.getCourseName(courseId);
            return courseName;
        }

        public int addCourse(Model.Course course)
        {
            Factory factory = new Factory();
            ISaveRepository saveRepository = factory.saveOperations();
            int courseID = saveRepository.insertCourse(course);
            return courseID;
        }

        public void updateCourse(Model.Course course)
        {
            Factory factory = new Factory();
            ISaveRepository saveRepository = factory.saveOperations();
            saveRepository.updateCourse(course);
        }

        public void addCourseDetails(Model.CourseDetails coursedetails)
        {
            Factory factory = new Factory();
            ISaveRepository saveRepository = factory.saveOperations();
            saveRepository.insertCourseDetails(coursedetails);
        }

        public void removeCourseDetails(int couseId)
        {
            Factory factory = new Factory();
            ISaveRepository saveRepository = factory.saveOperations();
            saveRepository.deleteCourseDetails(couseId);
        }

        public List<Model.Student> getStudentList(int courseId)
        {
            Factory factory = new Factory();
            IStudentRepository studentRepository = factory.getStudentOperations();
            List<Model.Student> studentName = studentRepository.selectStudent_Left(courseId);
            return studentName;
        }
        public List<Model.Student> getSelectedList(int courseId)
        {
            Factory factory = new Factory();
            IStudentRepository studentRepository = factory.getStudentOperations();
            List<Model.Student> studentName = studentRepository.selectStudent_Right(courseId);
            return studentName;
        }

        public List<Model.Teacher> getTeacherList()
        {
            Factory factory = new Factory();
            ITeacherRepository teacherRepository = factory.getTeacherOperations();
            List<Model.Teacher> teacher = teacherRepository.getTeacher();
            return teacher;
        }
    }
}
